<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册</title>
<link href="__PUBLIC__/Home/css/css.css" rel="stylesheet">
<script src="__PUBLIC__/Home/js/jquery.min.js"></script>
<script>
$(function(){
	$('#xieyi').click(function(){
		var xieyi = $('#xieyi').attr('checked');
		var html = '';
		if(xieyi == true){
			html = '<input type="submit" class="Login-button" style="margin-top:32px; border:0; border-radius:3px; cursor:pointer; font-size:16px; font-weight:600;" value="登 陆">';			
		}else{
			html = '<input type="button" class="Login-button" style="margin-top:32px; border:0; border-radius:3px; font-size:16px; font-weight:600; background:#CCC;" value="登 陆">';
		}
		$('#button').html(html);
	});
});
</script>
<script>
//发送短信
var clock = '';
var nums = 45; //有效时间(秒)
var btn;
function sendCode(thisBtn){	
	var mobile = $('#mobile').val();
	if(!checkMobile(mobile)){
		alert('请输入正确的手机号');
		return false;
	}else{
		btn = thisBtn;
		btn.disabled = true; //将按钮置为不可点击
		btn.value = nums+' 秒后重试';
		clock = setInterval(doLoop, 1000); //一秒执行一次
		//提交短信
		$.get("{:U('Public/ajax_send_mobile')}", { mobile:mobile },function(data){
			$('#hidden_sms').val(data);
		});
	}
}
//倒计时
function doLoop(){
	nums--;
	if(nums > 0){
		btn.value = nums+' 秒后重试';
	}else{
		clearInterval(clock); //清除js定时器
		btn.disabled = false;
		btn.value = '重新获取';
		nums = 45; //重置时间
	}
}
//检查手机号合法
function checkMobile(str) {
    var re = /^1\d{10}$/
    if (re.test(str)) {
        return true;
    } else {
        return false;
    }
}
</script>
<script>
function ajax_send_mobile(obj){
	var mobile = $('#mobile').val();
	$.get("{:U('Index/ajax_send_mobile')}", { mobile:mobile },function(data){
		$('#hidden_sms').val(data);
	});
	settime(obj);
}
</script>
<script>
function check(){
	var mobile = $('#mobile').val();
	var reg_name = /^[·a-zA-Z\u4E00-\u9FA5]{2,13}$/;
	if(mobile == ''){
		alert('手机号不能为空');
		return false;
	}
	var sms_code = $('#sms_code').val();
	if(sms_code == ''){
		alert('验证码不能为空');
		return false;
	}
	var password = $('#password').val();
	if(password == ''){
		alert('密码不能为空');
		return false;
	}
	var readname = $('#readname').val();
	if(readname == ''){
		alert('姓名不能为空');
		return false;
	}
	if(!reg_name.test(readname)){
		alert('姓名格式不正确');
		return false;
	}
	var idcard = $('#idcard').val();

	var tuijianren_id = $('#tuijianren_id').val();
	if(tuijianren_id == ''){
		alert('推荐人ID不能为空');
		return false;
	}	
	return true;
}
</script>
</head>

<body style="background:url(__PUBLIC__/Home/img/bj.jpg) repeat-x;">
<div class="head" style="margin-top:15px; width:1200px;">
    <a href="{:U('Index/index')}"><img style="width:178px; height:80px;" src="__PUBLIC__/Home/img/index/logo.png" class="left" ></a>
    <span class="size28 left line-height45">欢迎注册</span>
    <b class=" right size14 line-height45">已有帐号，<a href="{:U('Public/login')}" class="gray">请登录</a></b>
</div>
<div class="registered1">
<form action="__SELF__" method="post" onSubmit="return check();">
	<ul style="margin-left:140px;">
	    <li><span><laber style="color:#F00;">*</laber> 手机号：</span>
   	    <input type="text" name="mobile" id="mobile" placeholder="登陆账号" value=""><b></b></li>
    	<if condition="$sms_open == 0 &&  $sms_open !== null">
    	<li><span><laber style="color:#F00;">*</laber> 验证码：</span>
   	    
   	    <input type="text" name="sms_code" id="sms_code" placeholder="短信验证码" style="width:180px;">
		<input type="button" style=" width:120px; height:40px; position:relative; top:-4px; color:#FFF; background:#E43A3D; border-radius:3px;" id="btn" value="免费获取验证码" onclick="sendCode(this);" /></li>
    	</if>
    	<li><span><laber style="color:#F00;">*</laber> 设置密码：</span>
   	    <input type="password" name="password" id="password" placeholder="登陆密码"><b></b></li>
    	<li><span><laber style="color:#F00;">*</laber> 确认密码：</span>
   	    <input type="password" name="repassword" id="repassword" placeholder="请再次输入密码"><b></b></li>
   	    <li><span><laber style="color:#F00;">*</laber> 真实姓名：</span>
   	     <input type="text" name="readname" id="readname" placeholder="请输入真实姓名"><b></b></li>
   	    <!--<li><span>身份证号：</span>
   	    <input type="text" name="idcard" id="idcard" placeholder="请输入身份证号"><b></b></li>
    	<li><span>邀请人ID：</span>
		<input name="tuijianren_id" id="tuijianren_id" type="text" placeholder="请输入正确的推荐人ID"></li> -->
		<p><input id="xieyi" type="checkbox" style="position:relative; top:-2px;"> 我已阅读并同意
		  <a target="_blank" href="{:U('Public/user_xieyi')}"class="blue">《亿速用户注册协议》</a></p>
		  <div id="button"><input type="button" class="Login-button" style="margin-top:32px; border:0; font-size:16px; border-radius:3px; font-weight:600; background:#CCC;" value="登 陆" /></div>
    </ul>
</form>
<input type="hidden" id="hidden_sms">
<img src="__PUBLIC__/Home/img/1.jpg" width="501" height="492" class="left"></div>

<div style="text-align:center; margin-top:50px;">版权所有：亿速网络互联网信息服务股份有限公司 2016版权所有 ICP：沪ICP备16022678号-1</div>
</body>
</html>
